function updMemberDialog(
    {
        memberId,
        callback = Function()
    }
) {
    if (!memberId) {
        return $.toast('成员ID不能为空');
    }

    getMemberDetails({
        memberId,
    }, ({Code, Message, Result: memberInfo}) => {
        if (Code !== 10000) {
            return $.toast(Message);
        }

        const {memberName, phone, email, birthdate, sex, provinceId, cityId, areaId, address} = memberInfo;

        const $form = $(`
            <form class="mask-account" style="overflow: auto;max-height: 500px">
                <input type="hidden" name="memberId" value="${memberId}">
                <div style="margin: 0">
                    <span class="mask-account-tit"><sub style="color: red;">*</sub>姓名</span>
                    <span class="input-select"><input type="text" name="memberName" value="${memberName || ""}" placeholder="请输入姓名" /></span>
                </div>
                <div>
                    <span class="mask-account-tit">手机号</span>
                    <span class="input-select"><input type="text" name="phone"  value="${phone || ''}" placeholder="请输入手机号" /></span>
                </div>
                <div>
                    <span class="mask-account-tit">邮箱</span>
                    <span class="input-select"><input type="text" name="email" value="${email || ''}" placeholder="请输入邮箱" /></span>
                </div>
                
                <div>
                    <span class="mask-account-tit">生日</span>
                    <span class="input-select">
                        <input type="text" name="birthdate" value="${birthdate ? moment(birthdate).format("YYYY-MM-DD") : ""}" placeholder="请选择生日" readonly/>
                        <i class="bi-chevron-down"></i>
                    </span>
                </div>
                
                <div>
                    <span class="mask-account-tit">性别</span>
                    <span data-select="sex"></span>
                </div>
                
                <div>
                    <span class="mask-account-tit">省市区</span>
                    <input type="hidden" name="areaId" value="${areaId || ''}"/>
                    <span data-select="areaId"></span>
                </div>
                <div>
                    <span class="mask-account-tit">详细地址</span>
                    <span class="input-select"><input type="text" name="address" value="${address || ''}" placeholder="请输入详细地址" /></span>
                </div>
               
            </form>
        `)

        laydate.render({
            elem: $form.find('input[name=birthdate]')[0],
            type: "date",
            max: moment().format("YYYY-MM-DD")
        });

        const $sexSel = $.getSelect("sex", [
            {name: "请选择", value: ""},
            {name: "男", value: 1},
            {name: "女", value: 2},
        ]);
        if (sex) {
            $sexSel.setValue(sex);
        }
        $form.find('[data-select="sex"]').replaceWith($sexSel);

        const $areaSel = $.getCitySelect({
            provinceId,
            cityId,
            areaId,
            placeholder:"请选择所在城市",
            callback: ({areaId}) => {
                $form.find('[name=areaId]').val(areaId);
            }
        })
        $form.find('[data-select="areaId"]').replaceWith($areaSel);

        const $dialogWidget = $.dialog($form, {
            title: "编辑成员",
            width: "600px",
            ok: () => {
                const data = $.getFormData($form);

                updMember(data, res => {
                    const {Code, Message} = res;
                    if (Code !== 10000) {
                        return $.toast(Message);
                    }

                    $dialogWidget.remove();
                    $.toast("编辑成功");
                    callback();
                })

                return false;
            }
        })


    });


    function getMemberDetails(param, callback = Function()) {
        return $.sApi({
            data: param,
            url: "/api/Member/getMemberDetails"
        }, callback)
    }

    function updMember(param, callback = Function()) {
        return $.sApi({
            data: param,
            url: "/api/Member/updMember"
        }, callback)
    }
}